window.qtzId = null;

chrome.browserAction.onClicked.addListener(function () {
    let index = chrome.extension.getURL('qietuzai.html');

    if (window.qtzId) {
        chrome.tabs.update(window.qtzId, {selected: true});
    } else {
        chrome.tabs.create({url: index}, function (tab) {
            window.qtzId = tab.id;
        });
    }
});

chrome.tabs.onRemoved.addListener(function (tabId) {
    if (tabId === window.qtzId) {
        window.qtzId = null;
    } else {
      
    }
});